package cn.sh.tools.controller;

import cn.sh.tools.service.component.image.ImageComponent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "图片")
@RestController
@RequestMapping(value = "/image")
public class ImageController {

    @Autowired
    private ImageComponent imageComponent;

    @ApiOperation("将多张图片合成GIF动图")
    @RequestMapping(method = RequestMethod.POST, value = "/imagesToGif")
    public String imagesToGif(@RequestParam(value = "imagePath") String imagePath,
                              @RequestParam(value = "imageSuffix") String imageSuffix,
                              @RequestParam(value = "gifName") String gifName) {
        return this.imageComponent.imagesToGif(imagePath, imageSuffix, gifName);
    }

}
